﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace CSharp
{
    // class that contain node informations.
    class NodeInfo
    {
        int nd_Id;                // node id.
        double lon;              // node longitude.
        double lat;             // node latitude.
      //  List<int> way_Id;      // way id that contain this node.

        public NodeInfo()
        {
        }
    
        public NodeInfo(int id, string fname)
        {
            nd_Id = id;
             XmlTextReader reader = new XmlTextReader(fname);
             while (reader.Read())
             {
                 if (reader.NodeType == XmlNodeType.Element)
                 {
                     if (reader.Name == "node")
                     {

                         if (int.Parse(reader.GetAttribute(0)) == nd_Id)
                         {
                             lat = double.Parse(reader.GetAttribute(7));
                             lon = double.Parse(reader.GetAttribute(8));
                             break;
                         }
                     }
                 }
             }
            
        }

        
        public double Latitude()
        {
            return lat;
        }

        public double Longtiude()
        {
            return lon;
        }
    }
}